export interface SeatType {
  id: number;
  number: number;
  status: 0 | 1; // 0: 空闲, 1: 已占用
}

// 预设的座位数据，10排，每排10个座位
export const READING_ROOM_SEATS: SeatType[] = [
  // 第一排
  { id: 1, number: 1, status: 0 },
  { id: 2, number: 2, status: 1 },
  { id: 3, number: 3, status: 0 },
  { id: 4, number: 4, status: 0 },
  { id: 5, number: 5, status: 1 },
  { id: 6, number: 6, status: 0 },
  { id: 7, number: 7, status: 0 },
  { id: 8, number: 8, status: 1 },
  { id: 9, number: 9, status: 0 },
  { id: 10, number: 10, status: 0 },
  // 第二排
  { id: 11, number: 11, status: 1 },
  { id: 12, number: 12, status: 0 },
  { id: 13, number: 13, status: 0 },
  { id: 14, number: 14, status: 1 },
  { id: 15, number: 15, status: 0 },
  { id: 16, number: 16, status: 0 },
  { id: 17, number: 17, status: 1 },
  { id: 18, number: 18, status: 0 },
  { id: 19, number: 19, status: 0 },
  { id: 20, number: 20, status: 1 },
  // 第三排
  { id: 21, number: 21, status: 0 },
  { id: 22, number: 22, status: 1 },
  { id: 23, number: 23, status: 0 },
  { id: 24, number: 24, status: 0 },
  { id: 25, number: 25, status: 1 },
  { id: 26, number: 26, status: 0 },
  { id: 27, number: 27, status: 0 },
  { id: 28, number: 28, status: 1 },
  { id: 29, number: 29, status: 0 },
  { id: 30, number: 30, status: 0 },
  // 第四排
  { id: 31, number: 31, status: 1 },
  { id: 32, number: 32, status: 0 },
  { id: 33, number: 33, status: 0 },
  { id: 34, number: 34, status: 1 },
  { id: 35, number: 35, status: 0 },
  { id: 36, number: 36, status: 0 },
  { id: 37, number: 37, status: 1 },
  { id: 38, number: 38, status: 0 },
  { id: 39, number: 39, status: 0 },
  { id: 40, number: 40, status: 1 },
  // 第五排
  { id: 41, number: 41, status: 0 },
  { id: 42, number: 42, status: 1 },
  { id: 43, number: 43, status: 0 },
  { id: 44, number: 44, status: 0 },
  { id: 45, number: 45, status: 1 },
  { id: 46, number: 46, status: 0 },
  { id: 47, number: 47, status: 0 },
  { id: 48, number: 48, status: 1 },
  { id: 49, number: 49, status: 0 },
  { id: 50, number: 50, status: 0 },
  // 第六排
  { id: 51, number: 51, status: 1 },
  { id: 52, number: 52, status: 0 },
  { id: 53, number: 53, status: 0 },
  { id: 54, number: 54, status: 1 },
  { id: 55, number: 55, status: 0 },
  { id: 56, number: 56, status: 0 },
  { id: 57, number: 57, status: 1 },
  { id: 58, number: 58, status: 0 },
  { id: 59, number: 59, status: 0 },
  { id: 60, number: 60, status: 1 },
  // 第七排
  { id: 61, number: 61, status: 0 },
  { id: 62, number: 62, status: 1 },
  { id: 63, number: 63, status: 0 },
  { id: 64, number: 64, status: 0 },
  { id: 65, number: 65, status: 1 },
  { id: 66, number: 66, status: 0 },
  { id: 67, number: 67, status: 0 },
  { id: 68, number: 68, status: 1 },
  { id: 69, number: 69, status: 0 },
  { id: 70, number: 70, status: 0 },
  // 第八排
  { id: 71, number: 71, status: 1 },
  { id: 72, number: 72, status: 0 },
  { id: 73, number: 73, status: 0 },
  { id: 74, number: 74, status: 1 },
  { id: 75, number: 75, status: 0 },
  { id: 76, number: 76, status: 0 },
  { id: 77, number: 77, status: 1 },
  { id: 78, number: 78, status: 0 },
  { id: 79, number: 79, status: 0 },
  { id: 80, number: 80, status: 1 },
  // 第九排
  { id: 81, number: 81, status: 0 },
  { id: 82, number: 82, status: 1 },
  { id: 83, number: 83, status: 0 },
  { id: 84, number: 84, status: 0 },
  { id: 85, number: 85, status: 1 },
  { id: 86, number: 86, status: 0 },
  { id: 87, number: 87, status: 0 },
  { id: 88, number: 88, status: 1 },
  { id: 89, number: 89, status: 0 },
  { id: 90, number: 90, status: 0 },
  // 第十排
  { id: 91, number: 91, status: 1 },
  { id: 92, number: 92, status: 0 },
  { id: 93, number: 93, status: 0 },
  { id: 94, number: 94, status: 1 },
  { id: 95, number: 95, status: 0 },
  { id: 96, number: 96, status: 0 },
  { id: 97, number: 97, status: 1 },
  { id: 98, number: 98, status: 0 },
  { id: 99, number: 99, status: 0 },
  { id: 100, number: 100, status: 1 }
];

// 将一维数组转换为二维数组的辅助函数
export const convertToSeatRows = (seats: SeatType[], rowSize: number = 10) => {
  return Array.from({ length: seats.length / rowSize }, (_, rowIndex) =>
    seats.slice(rowIndex * rowSize, (rowIndex + 1) * rowSize)
  );
}; 